﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

[assembly: log4net.Config.XmlConfigurator(Watch =true)]

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int result = 0;
        if(!IsPostBack)
        {
            Response.Write("准备执行加法运算<br>");
            try
            {
                result = Multiplication();  //执行加法运算后，返回结果
                Response.Write("执行加法运算完成，结果是:" + result.ToString());
            }
            catch (Exception ex)
            {
               // Response.Write(ex.Message);  //打印错误信息
               log4net.ILog log=log4net.LogManager.GetLogger("logerror");
                log.Error("生成错误日志成功!");
            }
        }
    }
    protected int Multiplication(){
        int[] y=new int[3];
        int sum = 0;
        for(int i=0;i<4;i++)
        {
            y[i] = i;//给数组元素赋值
            sum = sum + y[i];  //求出数组元素之和
        }
        return sum;
    }
}